﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Microsoft.Xna.Framework.Graphics
{
    public static class SpriteBatchExtension
    {
        /// <summary>
        /// 根据矩阵渲染
        /// </summary>
        /// <param name="spriteBatch"></param>
        /// <param name="texture"></param>
        /// <param name="matrix"></param>
        public static void Draw(this SpriteBatch spriteBatch, Texture2D texture, Matrix matrix)
        {
            //Vector3 scale;// = new Vector2(matrix.M11, matrix.M22);//缩放
            //Vector3 translation;// = new Vector2(matrix.M41, matrix.M42);//平移
            //Quaternion rotation;//旋转因子
            ////matrix.Decompose(out scale, out quaternion, out translation);
            ////Vector2 angle = new Vector2(matrix.M12, matrix.M21);
            //spriteBatch.Draw(texture, translation, null, Color.White, 0, Vector2.Zero, scale, SpriteEffects.None, 0);
            spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, null, null, matrix);
            spriteBatch.Draw(texture, Vector2.Zero, Color.White);
            spriteBatch.End();
        }
    }
}
